//
//  UIButton+Extension.swift
//  WeiBo-Swift
//
//  Created by daniel on 2017/7/24.
//  Copyright © 2017年 daniel. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(imageName: String, backImageName: String?) {
        self.init()
        
        setImage(UIImage(named: imageName), for: .normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        
        if let backImgName = backImageName {
            setBackgroundImage(UIImage(named: backImgName), for: UIControlState())
            setBackgroundImage(UIImage(named: backImgName + "_highlighted"), for: .highlighted)
        }
        sizeToFit()
    }
    
}
